package com.jt.demo7_di;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

public class Person {
    private Integer id;
    private String name;
//    private Car car=new Car();
    private Car car;

    public void setCar(Car car) {
        this.car = car;
    }

    public void SayHi(){
        System.out.println(id+" "+name);
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void toGo() {
        car.go();
    }
}
